<%-- 
    Document   : draft_report
    Created on : Apr 27, 2013, 11:39:39 PM
    Author     : fikri
--%>
<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>.: Observation : draft report :.</title>        
    </head>
    <body>
        <s:messages/>
        <s:errors/>
        <s:useActionBean beanclass="exatrez.stripes.util.ListUtil" var="list"/>
        <s:form beanclass="exatrez.stripes.action.ObservationAction" name="form1">           
            <div>

                <div id="page-title">
                    <span class="title">Searching</span>
                </div>   
                <p>
                    <label>Vessel</label>
                    <s:select name="observation.vessel.vesselId" style="width:150px" class="clearAll">
                        <s:option value="">Please Choose</s:option>
                        <s:options-collection collection="${list.vesselList}" label="vesselName" value="vesselId"/>
                    </s:select>
                </p>
                <p>
                    <label>Date Of Inspection</label>
                    <s:text name="observation.dateOfInspection" id="datepicker" formatType="date" formatPattern="dd/MM/yyyy"
                            onblur="editDateBlur(this, 'DD/MM/YYYY')"
                            onkeypress="return editDatePre(this, 'DD/MM/YYYY', event)"
                            onkeyup="return editDate(this, 'DD/MM/YYYY', event);" class="clearAll"/>
                </p>
                <p>
                    <label>&nbsp;</label>
                    <s:submit name="searchDraftReport" value="Search" class="btn"/>
                    <s:button name="clear" value="Clear" class="btn clear"/>
                </p>

            </div>
            <c:if test="${!empty actionBean.listOfDraftObservation}">
                <div>
                    <display:table class="tablecloth" name="${actionBean.listOfDraftObservation}" requestURI="/observation?searchDraftReport" id="line">
                        <display:column title="No." ><center>${line_rowNum}.</center></display:column>
                            <display:column title="Vessel Name">
                            <a href="observation?view&id=${line.observationId}">${line.vessel.vesselName}</a>
                        </display:column>
                        <display:column title="Superintendent" property="vessel.superintendence.userId" />
                        <display:column title="Date Of Inspection">
                            <fmt:formatDate value="${line.dateOfInspection}" pattern="dd/MM/yyyy"/>
                        </display:column>
                        <display:column title="Location" property="location"/>
                        <display:column title="No of Observation">
                            ${fn:length(line.taskList)}
                        </display:column>
                        <display:column title="Severity<br/> H | M | L">
                            <c:set var="high" value="0"/>
                            <c:set var="medium" value="0"/>
                            <c:set var="low" value="0"/>
                            <c:forEach items="${line.taskList}" var="i">
                                <c:if test="${i.severity.severityCodeId eq '3'}">
                                    <c:set var="high" value="${high + 1}"/>
                                </c:if>
                                <c:if test="${i.severity.severityCodeId eq '2'}">
                                    <c:set var="medium" value="${medium + 1}"/>
                                </c:if>
                                <c:if test="${i.severity.severityCodeId eq '1'}">
                                    <c:set var="low" value="${low + 1}"/>
                                </c:if>
                            </c:forEach>
                            ${high} | ${medium} | ${low}
                        </display:column>
                        <display:column title="Action">
                            <center>
                                <a href="observation?submit&id=${line.observationId}" onclick="return confirm('Are you sure to submit?');">
                                    <img src="${pageContext.request.contextPath}/images/icon/form_submit.png" alt="submit"/>
                                </a>
                            </center>
                        </display:column>
                    </display:table>
                </div>
            </c:if>
        </s:form>
    </body>
</html>
